package edu.kit.csl.cratyli.control;

/**
 * This annealing function approximates a square root curve between the
 * start and end temperature.
 */
public class RootAnnealingFunction extends AnnealingFunction {
	
	final double f;
	
	/* (non-Javadoc)
	 * @see edu.kit.csl.cratyli.control.AnnealingFunction#AnnealingFunction()
	 */
	public RootAnnealingFunction() {
		super();
		f = (endTemperature - startTemperature) 
				* (endTemperature - startTemperature); 
	}

	/* (non-Javadoc)
	 * @see edu.kit.csl.cratyli.control.AnnealingFunction#getTemperature()
	 */
	@Override
	public double getTemperature() {
		return startTemperature + Math.sqrt(progress * f);
	}
}
